package com.wmx.thread;

import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;

public class MyObject {

    public int anInt = 1;
    public int num =1;
    public char aChar ='A';
    public boolean flg =true;

    @Override
    public String toString() {
        return super.toString();
    }

    synchronized void getOne(){
        System.out.println("anInt========"+anInt);
        anInt =200;
       System.out.println("方法一");
    };
    synchronized void getTwo(){
        System.out.println("anInt========"+anInt);
        System.out.println("方法二");
    };


    public static void main(String[] args) throws Exception{
        MyObject myObject = new MyObject();
        ThreadOne threadOne = new ThreadOne(myObject);
        ThreadTWo threadTWo = new ThreadTWo(myObject);

      //  threadTWo.start();
        threadOne.start();
       // threadOne.join();




       /*
        RunableOne runableOne = new RunableOne(myObject);
        Thread runableThread =  new Thread(runableOne);
        runableThread.start();*/



      /*  CallableOne callableOne = new CallableOne();
        // 1.执行Callable方式，需要FutureTask实现类的支持，用于接收运算结果
        FutureTask<Integer> futureTask = new FutureTask(callableOne);

        new Thread(futureTask).start();
        try {
            System.out.println("++++++++++++"+     (Integer)futureTask.get());
        }catch (Exception e){
            e.printStackTrace();
        }*/



    }
}
